package com.team.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.team.entity.Patient;
import com.team.util.RegisInfo;
import org.apache.ibatis.annotations.*;

import java.util.List;
@Mapper
public interface RegisInfoMapper extends BaseMapper<RegisInfo> {
    @Select("select registry.*,patient.*,department.*,sys_users.*,room.* from registry left join patient on registry.patient_id = patient.id left join department on registry.department_id =department.id left join sys_users on registry.user_id = sys_users.id left join room on registry.room_id =room.id")
    @Results({@Result(property = "patient",column = "patient_id",one = @One(select = "com.team.mapper.PatientMapper.getPatient")),
         @Result(property = "department",column = "department_id",one = @One(select = "com.team.mapper.DepartmentMapper.getDepartment")),
            @Result(property = "user",column = "user_id",one = @One(select = "com.team.mapper.SysUsersMapper.getSysUsers")),
            @Result(property = "room",column = "room_id",one = @One(select = "com.team.mapper.RoomMapper.getRoom"))
     })
    List<RegisInfo> getAllRegisInfo();

}
